<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<%@include file="/common/head.jsp" %>
<style>
    .form-group label.control-label {
        font-weight: normal;
        text-align: left;
    }

    .form-horizontal .form-group {
        margin-left: 20px;
    }

    h3 {
        margin: 20px 0;
    }
</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="form-horizontal">
        <h3>基本信息</h3>
        <div class="form-group">
            <label class="col-sm-4 control-label">机构名称：${customer.orgName}</label>
            <label class="col-sm-4 control-label">医生名称：${customer.name}</label>
            <label class="col-sm-3 control-label">登录账号：${customer.mobile}</label>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">身份证号：${customer.idCard}</label>
            <label class="col-sm-4 control-label">性别：${enum:list("Sex", customer.sex)}</label>
            <label class="col-sm-3 control-label">职称：${customer.title}</label>
        </div>
        <div class="form-group">
            <label class="col-sm-4 control-label">地址：${customer.address}</label>
            <label class="col-sm-4 control-label">建立时间：<fmt:formatDate value="${customer.created}" pattern="yyyy-MM-dd"/></label>
        </div>
        <h3>代理商信息</h3>
        <div id="services">
            <div class="form-group">
                <label class="col-sm-4 control-label">所属代理商：${customer.agent.orgName}</label>
                <label class="col-sm-4 control-label">负责人：${customer.agent.manager}</label>
                <label class="col-sm-3 control-label">联系方式：${customer.agent.mobile}</label>
            </div>
        </div>
        <h3>账号信息</h3>
        <div class="form-group">
            <label class="col-sm-4 control-label">到期时间：
                <c:choose>
                    <c:when test="${customer.expireDate == null }">
                        <fmt:formatDate value="${customer.created}" pattern="yyyy-MM-dd"/>
                    </c:when>
                    <c:otherwise>
                        <c:if test="${restDays < 10 }">
                            <b style="color: red;"><fmt:formatDate value="${customer.expireDate}" pattern="yyyy-MM-dd"/></b>
                        </c:if>
                        <c:if test="${restDays >= 10}">
                            <fmt:formatDate value="${customer.expireDate}" pattern="yyyy-MM-dd"/>
                        </c:if>
                    </c:otherwise>
                </c:choose>
            </label>
            <label class="col-sm-4 control-label">剩余时间：
                <c:choose>
                    <c:when test="${customer.expireDate == null }">
                        <b style="color: red;">未激活</b>
                    </c:when>
                    <c:otherwise>
                        <c:if test="${restDays < 10 && restDays >= 0}">
                            <b style="color: red;">${restDays}天</b>
                        </c:if>
                        <c:if test="${restDays >= 10}">${restDays}天</c:if>
                        <c:if test="${restDays < 0}">
                            <b style="color: red;">已过期</b>
                        </c:if>
                    </c:otherwise>
                </c:choose>
            </label>
        </div>
    </div>

    <table id="table" data-toggle="table" data-striped="true" data-click-to-select="true"
           data-mobile-responsive="true">
        <thead>
        <tr>
            <th data-field="type">账号类型</th>
            <th data-field="createDate">使用时间</th>
            <th data-field="expiration">有效期</th>
            <%--<th data-field="amount">使用个数</th>--%>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${servicePackageList}" var="s">
        <tr>
            <td>${s.servicePackage.name}</td>
            <td><fmt:formatDate value="${s.created}" pattern="yyyy-MM-dd"/></td>
            <td>${s.servicePackage.expireDays}天</td>
            <%--<td>${s.count}</td>--%>
        </tr>
        </c:forEach>
        </tbody>
    </table>
</div>

<%@include file="/common/foot.jsp" %>
</body>
</html>
